parse errors correctly