duplicate id fix, added test