Update the uid generator from @hujiajie suggestion