Improves error handling.