improve DEBUG mechanism