Fix references to variables