Fix code for write log