add beacon debug code