fix the bug by updating the key-value pairs in dictionary