Tweaked error reporting in debug mode