Prevent EOFError infinite loop