changed log logic