added an error output if in debug mode