Fix error handling functions.