added some error checking to read_instance_metadata