modification to exception handling code