Fix "id generation bug"