scoping issue on member function