Fix function and expressions scoping issue with instance methods