Further improve error handling.