fix bugs regarding event triggering