Fix duplicate id bug