fixed issues with undeclared variables