Fix scoping issue with parsed methods and add test