diff --git a/~dev_rating/application/classes/Controller/Handler/Settings.php b/~dev_rating/application/classes/Controller/Handler/Settings.php
index 6fa77af8abb2d8626f32a85a3de21f8ef00dff3e..aa184f91ca8683453aee132fa6b37cc5cc53451c 100644
--- a/~dev_rating/application/classes/Controller/Handler/Settings.php
+++ b/~dev_rating/application/classes/Controller/Handler/Settings.php
@@ -100,7 +100,9 @@ class Controller_Handler_Settings extends Controller_Handler {
             $this->post
                 ->rule('semesterID', 'not_empty')
                 ->rule('semesterID', 'digit');
-            $semesterID = $this->post->offsetGet('semesterID');
-            User::instance()->SetSemester($semesterID);
+            if($this->post->check()) {
+                $semesterID = $this->post->offsetGet('semesterID');
+                User::instance()->SetSemester($semesterID);
+            }
         }
 }
\ No newline at end of file
diff --git a/~dev_rating/modules/account/classes/Kohana/User.php b/~dev_rating/modules/account/classes/Kohana/User.php
index 4bbb05f51eca38a43705a6e4a1978e059961df6c..d4cfda8fdbf6e4a7abb05a36225ca99710d4b3c6 100644
--- a/~dev_rating/modules/account/classes/Kohana/User.php
+++ b/~dev_rating/modules/account/classes/Kohana/User.php
@@ -57,8 +57,9 @@ class Kohana_User implements ArrayAccess {
     }
     
     public function SetSemester($semesterID) {
-        $this->_model->SetSemesterID($semesterID);
-        $this->_session->set("SemesterID", $semesterID);
+        $res = $this->_model->SetSemesterID($semesterID);
+        if ($res >= 0)
+            $this->_session->set("SemesterID", "$semesterID");
     }
 
     
diff --git a/~dev_rating/modules/account/classes/Model/Kohana/Account.php b/~dev_rating/modules/account/classes/Model/Kohana/Account.php
index a782516dce2cee5f089d01adff36d8b34d06f76f..677e86801b7ca93eccd67b0eb6ed0331c7de6a98 100644
--- a/~dev_rating/modules/account/classes/Model/Kohana/Account.php
+++ b/~dev_rating/modules/account/classes/Model/Kohana/Account.php
@@ -175,6 +175,7 @@ class Model_Kohana_Account extends Model
     {
         $sql = "SELECT `SetSemesterID`('$semesterID') AS `Num`; ";
         $res = DB::query(Database::SELECT, $sql)->execute();
+        $id = 0;
         foreach ($res as $value) {
             $id = $value['Num'];
         }