Fixes correct error reporting