diff --git a/src/main.cpp b/src/main.cpp
index eb81dd5..b3c0b9e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -43,6 +43,7 @@ static const wstring INPUT_RELEASE_CALLBACK=L"fluxus-input-release-callback";
 FluxusMain *app = NULL;
 EventRecorder *recorder = NULL;
 int modifiers = 0;
+bool exe = false;
 
 void ReshapeCallback(int width, int height)
 {
@@ -238,9 +239,14 @@ void DisplayCallback()
 		glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
 	}
 
+
 	app->Render();
 	glutSwapBuffers();
-
+	if(exe){
+		app->Execute();
+		exe = false;
+	}
+	
 	DoRecorder();
 }
 
@@ -306,7 +312,6 @@ int run(void *data)
 	recorder = new EventRecorder;
 	int arg=1;
 	int currentEditor=0;
-	bool exe=false;
 
 	while(arg<argc)
 	{
@@ -411,7 +416,6 @@ int run(void *data)
 				app->LoadScript(string_to_wstring(string(argv[arg])));
 				if (exe && currentEditor==0)
 				{
-					app->Execute();
 					app->HideScript();
 				}
 				currentEditor++;
