More refinement of error handling