Fix possible runtime error in multi-part method calls

Currently `foo()bar(.)` causes a runtime error. This commit fixes that.