100% safe uid function