Fixing error with undeclared name