Fix idgenerator bug