Fix compatibility with java 5