changed error handling for #3