improved compatibility to java 6+ instead of java 7