added handler ids, fixed a leak into global scope