Fix pagination for nodes when sorting