Fix the bug that returns the ID of the last record, not the new ID (that is the next value of the last ID).