Patch 1

1) Discounts were being unset below unless I changed this in line 817
2) I was getting 'Fatal error: Unsupported operand types' on lines below here on certain discount codes only without the additional condition on line 840