added compatibility for java 8