change in getting the maxId