beef up the exception handling a little bit