fixes in division by zero in discount calculation