improved handling of the exception