Fix minor undeclared variables bugs.