diff --git a/code/classes/SCDclass_expcode.m b/code/classes/SCDclass_expcode.m
index 6b46033118703973893781c4d7bd9ebb11e28980..64c46f9f3434045798942c4a1471ce14215f1652 100644
--- a/code/classes/SCDclass_expcode.m
+++ b/code/classes/SCDclass_expcode.m
@@ -554,14 +554,13 @@ classdef SCDclass_expcode
             tcv([],[],[],'compile');
             tcv([],[],[],'term');
           catch ME
-            tcv([],[],[],'term');
             rethrow(ME)
           end
         end
         
         function sim(obj)
           sim('tcv')
-        end
+        end  
     end
    
     methods (Access = private)
diff --git a/tests/test_expcodes.m b/tests/test_expcodes.m
index e7e73f1e3f61c559085395c7fca9b962d666cdbf..a3ab738a0a87304bd215a58a849e1671293f4494 100644
--- a/tests/test_expcodes.m
+++ b/tests/test_expcodes.m
@@ -6,7 +6,6 @@ classdef test_expcodes < matlab.unittest.TestCase
   end
   
   properties(MethodSetupParameter)
-    %expcode_number = {'1','1005','1006','1010'}; % list of expcodes to test
     expcode_number = {'1','1005','1010'}; % list of expcodes to test
   end
   
@@ -36,7 +35,7 @@ classdef test_expcodes < matlab.unittest.TestCase
       fprintf('\n=== Testing callinits for expcode %d: %s === \n',...
         testCase.expcode_obj.maincode,testCase.expcode_obj.name);
       testCase.expcode_obj.callinits;
- 
+      
       fprintf('\n=== Testing setup for expcode %d: %s === \n',...
         testCase.expcode_obj.maincode,testCase.expcode_obj.name);
       
@@ -46,34 +45,25 @@ classdef test_expcodes < matlab.unittest.TestCase
   end
   
   methods(Test)
-    function test_expcode(testCase)
+    function test_expcode_compile(testCase)
       fprintf('\n === Testing Simulink compilation for expcode %d: %s === \n',...
         testCase.expcode_obj.maincode,testCase.expcode_obj.name);
       % attempt compiling tcv.slx for this expcode
       testCase.expcode_obj.compile; % compile tcv.slx with this expcode
     end
     
-    function test_gencode(testCase)
-        switch testCase.expcode_obj.maincode
-            case 1010
-                
-                SCDconf_setCODEconf('configurationSettingsCODEicc')
-                rtwbuild('SCD_rtccode_02_02');
-                rtwbuild('SCD_rtccode_02_03');
-            otherwise
-                % do nothing
-        end
+    function test_rtwbuild(testCase)
+      assert(~isempty(getenv('RTCCODE_LIBPATH')),'RTCCODE_LIBPATH environment variable needs to be defined to compile');
+      SCDconf_setCODEconf('configurationSettingsCODEicc')
+      switch testCase.expcode_obj.maincode
+        case 1005
+          rtwbuild('SCD_rtccode_02_02');
+        case 1010
+          rtwbuild('SCD_rtccode_02_02');
+          rtwbuild('SCD_rtccode_02_03');
+        otherwise
+          % do nothing
+      end
     end
-    
-   function test_compilation(testCase)
-     expcode_ignore_compile = [];
-     testCase.assumeTrue(~any(testCase.expcode_obj.maincode == expcode_ignore_compile))
-     node_to_compile = 'SCD_rtccode_02_02';
-     node_to_compile = 'SCD_rtccode_02_03';
-
-     load_system(node_to_compile);
-     SCDconf_setCODEconf;
-     rtwbuild(node_to_compile);
-   end
   end
 end