Fix various bugs for running on EC2