Fixed generation of unique id values

Fixes #6371.
Merge pull request #6372 from pjackson28/fixuniqueidgeneration

Fixed generation of unique id values