Fixed bug in uid logic