fix various bugs for running on EC2