fix some bugs for gestures