Test and improve error handling.