Make code compatible with java 6