honor cust_main DEBUG flag, add some additional debug info, RT#10012