Bug fix for the custom error handling