added a few diagnostics on output file