Added Java 8 compatibility.

Some minor change to get it working with Java 8.