Fixed compatibility issues with Java 1.6