better handling of parse errors