fix the log function.