diff --git a/db/StoredProcedures.sql b/db/StoredProcedures.sql
index 8fadd3c1d74c1c32b76121b0d11e3d9f0c616d78..38779393c9d35aa7ec0d24325217253de955c040 100644
--- a/db/StoredProcedures.sql
+++ b/db/StoredProcedures.sql
@@ -2987,7 +2987,7 @@ BEGIN
 	INNER JOIN `disciplines` 	ON 	disciplines.ID = modules.DisciplineID
 	WHERE 	TeacherID = disciplines.AuthorID AND
 			SubmoduleID = submodules.ID	AND
-			modules.Type = 0
+			modules.Type = 1
 	LIMIT 1;
     IF checker <= 0 THEN
     	RETURN -1;
diff --git a/db/fix.sql b/db/fix.sql
new file mode 100644
index 0000000000000000000000000000000000000000..3549e82a3009140af24afa5e38e32cd9dce4018a
--- /dev/null
+++ b/db/fix.sql
@@ -0,0 +1,31 @@
+DELIMETER //
+DROP FUNCTION IF EXISTS ChangeSubmoduleControlType//
+CREATE FUNCTION `ChangeSubmoduleControlType`(	`TeacherID` 	INT, 
+												`SubmoduleID` 	INT, 
+												`ControlType`	VARCHAR(30) charset utf8
+											)	RETURNS int(11)
+    NO SQL
+BEGIN  
+    DECLARE checker INT;  					 
+	
+	SET checker = -1;
+	SELECT submodules.ID 
+	INTO checker 
+	FROM `submodules`
+	INNER JOIN `modules` 		ON 	submodules.ModuleID = modules.ID
+	INNER JOIN `disciplines` 	ON 	disciplines.ID = modules.DisciplineID
+	WHERE 	TeacherID = disciplines.AuthorID AND
+			SubmoduleID = submodules.ID	AND
+			modules.Type = 1
+	LIMIT 1;
+    IF checker <= 0 THEN
+    	RETURN -1;
+	END IF;
+
+	UPDATE `submodules` 
+	SET submodules.Type = ControlType
+	WHERE submodules.ID = SubmoduleID
+	LIMIT 1;
+	RETURN 0;
+END //
+DELIMETER ;
\ No newline at end of file