Small fixes to error handling