fix bug in log.c