Fixed uuid generation algorithm
added some tests