fixing an issue with discount calculation