fixed bug where the old definitions are not being cleared from the DOM