Exception handling improved