diff --git a/modules/registrars/cozaepp/cozaepppoll.php b/modules/registrars/cozaepp/cozaepppoll.php
index 23192fcb7f044628086bd18fea25e079dded58e9..1b5f7a2334290e4074e443ff1177e543d9b4058c 100644
--- a/modules/registrars/cozaepp/cozaepppoll.php
+++ b/modules/registrars/cozaepp/cozaepppoll.php
@@ -72,7 +72,7 @@ if (PEAR::isError($client = _cozaepp_Client())) {
 # Loop with message queue
 while (!$last) {
 	# Request messages
-	$output= $client->request('
+	$request = $client->request('
 	<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
 		<command>
 			<poll op="req"/>
@@ -82,7 +82,7 @@ while (!$last) {
 
 	# Decode response
 	$doc= new DOMDocument();
-	$doc->loadXML($output);
+	$doc->loadXML($request);
 
 	# Pull off code
 	$coderes = $doc->getElementsByTagName('result')->item(0)->getAttribute('code');
@@ -97,10 +97,13 @@ while (!$last) {
 			$last = 1;
 		}
 
-		$msgid = $doc->getElementsByTagName('msgQ')->item(0)->getAttribute('id');
-		$res = _cozaepp_ackpoll($client,$msgid);
-		if (PEAR::isError($res)) {
-			echo("ERROR: ".$res->getMessage()."\n");
+		$msgq = $doc->getElementsByTagName('msgQ')->item(0);
+		if ($msgq) {
+			$msgid = $doc->getElementsByTagName('msgQ')->item(0)->getAttribute('id');
+			$res = _cozaepp_ackpoll($client,$msgid);
+			if (PEAR::isError($res)) {
+				echo("ERROR: ".$res->getMessage()."\n");
+			}
 		}
 
 	} else {
@@ -109,7 +112,7 @@ while (!$last) {
 		for ($m = 0; $m < $msgs->length; $m++) {
 			echo "\n";
 		    echo "UNKNOWN CODE: $coderes, MESSAGE: '".$msgs->item($m)->textContent."', ID: $msgid\n";
-			echo $output;
+			echo $request;
 			echo "\n\n";
 		}