fixed possible bug with declaring var