log function fix