changed the logic for getting the first object on a page