Fix java 8u20. Closes #501 and a bunch of other bugs too.