Memory leak and java 8 issue fix

Hi,

You may be interested in these patches.

( I meant from my head into your head - github got it wrong.)
(ugh, even more wrong. ignore this request.)

Greetings,
Michael.