modified logic of IdManager