Changed the query paging implementation on mongodb and other fix