made script compatible with Java 6