issue #75

a fix for a bug in linear gradients.
and a fix for memory leak