assign to variable in anonymous function