fixed #310: properly recognize class methods

This does the trick for me, though I'm not sure if it's the most elegant way to do it. New to the codebase.