Fixes #5308: object function calls in templates were passing arguments in a wrong way