Index: /trunk/Decompiler.class.php
===================================================================
--- /trunk/Decompiler.class.php	(revision 745)
+++ /trunk/Decompiler.class.php	(revision 746)
@@ -434,20 +434,21 @@
 			$op = $opcodes[$i];
 			if (isset($op['php'])) {
-				$toticks = isset($op['ticks']) ? $op['ticks'] : 0;
+				$toticks = isset($op['ticks']) ? (int) str($op['ticks']) : 0;
 				if ($curticks != $toticks) {
-					if (!$toticks) {
+					$oldticks = $curticks;
+					$curticks = $toticks;
+					if (!$curticks) {
 						echo $origindent, "}\n";
 						$indent = $origindent;
 					}
 					else {
-						if ($curticks) {
+						if ($oldticks) {
 							echo $origindent, "}\n";
 						}
-						else if (!$curticks) {
+						else if (!$oldticks) {
 							$indent .= INDENT;
 						}
-						echo $origindent, "declare(ticks=$curticks) {\n";
-					}
-					$curticks = $toticks;
+						echo $origindent, "declare (ticks=$curticks) {\n";
+					}
 				}
 				echo $indent, str($op['php'], $indent), ";\n";
@@ -719,5 +720,5 @@
 		if (!empty($op['jmpouts']) && isset($op['isjmp'])) {
 			if (isset($op['cond'])) {
-				echo "{$indent}check ($op[cond]) {\n";
+				echo "{$indent}check (" . str($op["cond"]) . ") {\n";
 				echo INDENT;
 			}
@@ -1327,5 +1328,5 @@
 					$type = $op2['var']; // hack
 					$keyword = $this->includeTypes[$type];
-					$resvar = "$keyword(" . $this->getOpVal($op1, $EX) . ")";
+					$resvar = "$keyword(" . str($this->getOpVal($op1, $EX)) . ")";
 					break;
 					// }}}
