fix some bugs related to event binding