Prevent issue where dublicate pk on insert.
Merge branch 'hotfix-1.0.1'