Mod: fixed a bug in allocating ring