Fix more legacy variable syntax. Correct variable referece syntax where necesary