Fixed duplicate key issues