Fix key already exists bug.
Merge pull request #1798 from vbjay/Portable

Fix key already exists bug.