ensure the debug messages are only displayed with debug flag