Fix log function