Fix some formatting and bugs in data logging.