Fix bug on applying discounts