Fixed error checks in log writer.