fix remove js-function, adding flag for event