Apply bug fixes to ec2-metadata script.