Stop using deprecated .exists method.
Some JVM compatibility fixes.