Handle local function calls

There was a problem when calling a method on "self" from within an instance. In that case the function tried to claim itself and ended up in a deadlock.