Improved compatibility with JDK6