Fixed some incompatibilities with Java 7