Adding additional debug checks around log statements