fix issue #2 error handling