fix bug and improve code structure in uniqueID.js