Fixed to work with JDK 1.6