fixing var refs