Modified error handling to be more permissive