changed how we get the max item id