diff --git a/~dev_rating/application/classes/Model/Helper/CourseWorkBuilder.php b/~dev_rating/application/classes/Model/Helper/CourseWorkBuilder.php
index 9257035b3fe3112720af0b9fa5ace0bf4eb07b63..ec119996c2117458da22e73dffb19fdcd2cf39ea 100644
--- a/~dev_rating/application/classes/Model/Helper/CourseWorkBuilder.php
+++ b/~dev_rating/application/classes/Model/Helper/CourseWorkBuilder.php
@@ -42,7 +42,7 @@ class Model_Helper_CourseWorkBuilder extends Model_Helper_Builder
 
     /** Must be called after subtype() */
     function & subject($id) {
-        if ($this->data['Subtype'] == Model_CourseWork::SCIENTIFIC)
+        if ($this->data['Subtype'] === Model_CourseWork::SCIENTIFIC)
             $id = self::COURSEWORK_DISCIPLINE_ID;
 
         if (!is_numeric($id) || $id <= 0)
@@ -53,6 +53,9 @@ class Model_Helper_CourseWorkBuilder extends Model_Helper_Builder
     }
 
     function & subtype($name) {
+        if (!is_string($name))
+            throw new InvalidArgumentException('Type is incorrect');
+
         switch ($name) {
             case Model_CourseWork::DISCIPLINARY:
             case Model_CourseWork::SCIENTIFIC:
diff --git a/~dev_rating/application/classes/Model/Helper/DisciplineBuilder.php b/~dev_rating/application/classes/Model/Helper/DisciplineBuilder.php
index e161e445ef52c7cf4c1fd4ed9deed3c02ddbc679..21d8218fd2a04131dbf871d26c5c940732d69cc9 100644
--- a/~dev_rating/application/classes/Model/Helper/DisciplineBuilder.php
+++ b/~dev_rating/application/classes/Model/Helper/DisciplineBuilder.php
@@ -65,8 +65,18 @@ class Model_Helper_DisciplineBuilder extends Model_Helper_Builder
     }
 
     function & type($name) {
-        if (!$name)  // todo: enum
-            throw new InvalidArgumentException('type is incorrect');
+        if (!is_string($name))
+            throw new InvalidArgumentException('Type is incorrect');
+
+        switch ($name) {
+            case Model_Discipline::EXAM:
+            case Model_Discipline::CREDIT:
+            case Model_Discipline::GRADING_CREDIT:
+                break;
+            default:
+                throw new InvalidArgumentException('Type is incorrect');
+        }
+
         $this->data['Type'] = $name;
         return $this;
     }