more robust UID generation