Index: /trunk/utils.c
===================================================================
--- /trunk/utils.c	(revision 234)
+++ /trunk/utils.c	(revision 235)
@@ -425,6 +425,4 @@
 				NULL
 				) == FAILURE) {
-		CG(in_compilation) = 1;
-		CG(compiled_filename) = filename;
 		CG(zend_lineno) = 0;
 #ifdef IS_UNICODE
@@ -461,6 +459,4 @@
 					NULL
 					) == FAILURE) {
-			CG(in_compilation) = 1;
-			CG(compiled_filename) = filename;
 			CG(zend_lineno) = ZESW(func->op_array.opcodes[0].lineno, func->op_array.line_start);
 #ifdef IS_UNICODE
@@ -497,6 +493,4 @@
 				ZESW(&stored_ce_ptr, NULL)
 				) == FAILURE) {
-		CG(in_compilation) = 1;
-		CG(compiled_filename) = filename;
 		CG(zend_lineno) = ZESW(0, cep->line_start);
 #ifdef IS_UNICODE
@@ -619,5 +613,10 @@
 
 	if (install) {
+		CG(in_compilation)    = 1;
+		CG(compiled_filename) = sandbox->filename;
+		CG(zend_lineno)       = 0;
 		xc_sandbox_install(sandbox TSRMLS_CC);
+		CG(in_compilation)    = 0;
+		CG(compiled_filename) = NULL;
 
 		/* no free as it's installed */
Index: /trunk/xcache.c
===================================================================
--- /trunk/xcache.c	(revision 234)
+++ /trunk/xcache.c	(revision 235)
@@ -1075,4 +1075,7 @@
 
 restore:
+	CG(in_compilation)    = 1;
+	CG(compiled_filename) = stored_xce->name.str.val;
+	CG(zend_lineno)       = 0;
 #ifdef DEBUG
 	fprintf(stderr, "restoring\n");
@@ -1105,4 +1108,6 @@
 		zend_bailout();
 	}
+	CG(in_compilation)    = 0;
+	CG(compiled_filename) = NULL;
 #ifdef DEBUG
 	fprintf(stderr, "restored\n");
