Fixed bug in error reporting