Fix couple of bugs.  Print output to file. Writes to STDOUT.