Setup wizard crashes if no default course state or multiple course states set
diff --git a/pyramus/src/main/java/fi/otavanopisto/pyramus/views/system/setupwizard/CourseStatesSetupWizardViewController.java b/pyramus/src/main/java/fi/otavanopisto/pyramus/views/system/setupwizard/CourseStatesSetupWizardViewController.java
index 84741d5eb..9036566e7 100644
--- a/pyramus/src/main/java/fi/otavanopisto/pyramus/views/system/setupwizard/CourseStatesSetupWizardViewController.java
+++ b/pyramus/src/main/java/fi/otavanopisto/pyramus/views/system/setupwizard/CourseStatesSetupWizardViewController.java
@@ -28,7 +28,7 @@ public class CourseStatesSetupWizardViewController extends SetupWizardController
     for (int i = 0; i < rowCount; i++) {
       String colPrefix = "courseStatesTable." + i;
       
-      Boolean initialState = "1".equals(requestContext.getString(colPrefix + ".initialState"));
+      Boolean initialState = "true".equals(requestContext.getString(colPrefix + ".initialState"));
       String name = requestContext.getRequest().getParameter(colPrefix + ".name");
       CourseState courseState = courseStateDAO.create(name);
       
diff --git a/pyramus/src/main/webapp/scripts/gui/system/setupwizard/coursestates.js b/pyramus/src/main/webapp/scripts/gui/system/setupwizard/coursestates.js
index fbabbd535..5bec3d50d 100644
--- a/pyramus/src/main/webapp/scripts/gui/system/setupwizard/coursestates.js
+++ b/pyramus/src/main/webapp/scripts/gui/system/setupwizard/coursestates.js
@@ -21,7 +21,7 @@ function onLoad(event) {
       header : getLocale().getText("system.setupwizard.coursestates.courseStatesTableInitialStateHeader"),
       left : 8,
       width : 100,
-      dataType : 'checkbox',
+      dataType : 'radiobutton',
       editable : false,
       paramName : 'initialState'
     }, {
diff --git a/pyramus/updates/49.001/170821_applications.xml b/pyramus/updates/49.001/170821_applications.xml
index 7791b3bbe..b31ae6822 100644
--- a/pyramus/updates/49.001/170821_applications.xml
+++ b/pyramus/updates/49.001/170821_applications.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <update xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.ofw.fi/xml/2011/java-xmldb-updater/UpdaterSchema.xsd">
 
-  <sql>insert into SettingKey (id,name) select max(id) + 1, 'application.storagePath' from SettingKey;</sql>
+  <sql>insert into SettingKey (id,name) select coalesce(max(id),0) + 1, 'application.storagePath' from SettingKey;</sql>
   <sql>update hibernate_sequences set sequence_next_hi_value = (select max(id) + 1 from SettingKey) where sequence_name = 'SettingKey';</sql>
   
   <sql>
['pyramus/updates/49.001/170821_applications.xml', 'pyramus/src/main/webapp/scripts/gui/system/setupwizard/coursestates.js', 'pyramus/src/main/java/fi/otavanopisto/pyramus/views/system/setupwizard/CourseStatesSetupWizardViewController.java']