some changes to support java 6