Modified to support java 1.7