Index: /issm/trunk-jpl/src/m/classes/clusters/generic_static.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/clusters/generic_static.m	(revision 20543)
+++ /issm/trunk-jpl/src/m/classes/clusters/generic_static.m	(revision 20544)
@@ -51,4 +51,12 @@
 		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota) % {{{
 
+			%Check that issm.exe exists in the right path
+			if ~exist([cluster.codepath '/issm.exe'],'file'),
+				error(['File ' cluster.codepath '/issm.exe does not exist']);
+			end
+
+			%Now process codepath and replace empty spaces with \ to avoid errors in queuing script
+			codepath2=strrep(cluster.codepath,' ','\ ');
+
 			%write queuing script
 			%what is the executable being called?
@@ -64,5 +72,5 @@
 			fid=fopen([modelname '.queue'],'w');
 			fprintf(fid,'#!%s\n',cluster.shell);
-			fprintf(fid,[cluster.codepath '/mpiexec -np %i %s/%s %s %s %s \n'],cluster.np,cluster.codepath,executable,EnumToString(solution),'./',modelname);
+			fprintf(fid,['%s/mpiexec -np %i %s/%s %s %s %s \n'],codepath2,cluster.np,codepath2,executable,EnumToString(solution),'./',modelname);
 			fclose(fid);
 
