Modified the conditions for printing a trace message to reduce verbosity