modified the codes to fix bugs

Without the # in the switch case, the code doesn't work properly and the
condition for #upc shoule be ||, not && to return the list correctly.