Fix duplicate key exception
Merge pull request #1767 from mdonatas/duplicate-key

Fix duplicate key exception