Fixed bug in guid algorithm