Fix a bug that incorrectly calculated the maximum ID