fix error handling code for issue #3