Fix pagination and routing