Fixed duplicate key problem