NXP-1157: handle context variable replacements with ugly code