Fix uid generation
Fix bug introduced in last commit
Fix #5