fix glitch adding event handler to element not yet on DOM