better error handling after parsing