bug in log function