Fixed exit condition check by removing minus sign. Corrected spelling mistake in debug message.