[TASK] Improve variable access in compiled templates