fixes var access bug