Added some minor exception handling improvements