prevent event handlers from being called multiple times