Fix error handling.