fixing popup and js error on dispensing