exception handling improvements