Issues with assigning a unique number