fixed compatibility with java 6