another fix to the error handling code