changed some logging logic