fix error handling in #2