Bug fixes and support for Java 1.7