fixing undeclared vars