fix bug in error reporting