Fix bugs with events and gestures