Make code compatible with Java 6