fixing var bug