Fix bug of checking for horizontal to vertical scrolling.