Fix a bug in ec2instancemanager