add Lifettime support
make code compatabile with java 1.6