fix the stock variation logic again