Workaround for Java 7 bugs