Fixed a couple gradient memory leaks