Fixes error handling.