bug in variable lookup in js template