beef up the exception handling