fix pagenation query issue