use EC2_HOME env variable
fix some bugs