slightly changed error reporting