corrected $var variable in switch