added compatibility with java 7