Fixing bug in error reporting