Fix undeclared variable issues.