Set var in closure-friendly way