Bug fixes in union and for running on ec2