remove existing event handlers correctly