Log writing corrected