Changing the logic for auto id generation