Fixed error in the condition to stop binary read