Fixed bug in output writer.