Fix gradient rendering code so re-rendering works without crashing
Merge pull request #227 from phatmann/fix-gradient-rerender

Fix gradient rendering code so re-rendering works without crashing