semantic: Ensure scope can be passed to functions correctly.