calculate new index if size changed