Fixing a bug in error reporting