move check for machine_name out of ifs