Minor fix to method that generates unique names.