fix java 1.6 compatibility, and make sure it's maintained in the future