improved log file writes