Make the UniqueId function really return unique id; Add a test case to p...

...rove it fixed