debug mode, output format fixes