Update to handle the duplicated dictionary keys