Fixing issues with error handling.