 			delay(waitforWriteResponse);
 
 			// Make sure time on card is zero when registered
-			if (!id) {
+			if (id) {
 				preparePayload(COMMAND_RESET_TIME, 0, 0, 0);
 				sendCommand(CMD_WRITE, blockID, machineID);
-				while (!id) {
+				while (id) {
 					Serial.write(id);
 					id >>= eightBits;
 				}

			sendCommand(CMD_WRITE, blockID, userData);
			delay(waitforWriteResponse);

			while (!id) {
				Serial.write(id);
				id >>= eightBits;
			}

			existingTime = getTime(readData, numTimeBytes, timeOffset);

			// Send it to ACM
			while (existingTime) {
				Serial.write(existingTime);
				existingTime >>= eightBits;
			}
