Fix code for Java 6