fixed the critical bug in turning page by swiping.