correct error reporting and corresponding test