fix swipe function