Fix for timing issue in swipe gesture