fix sourcing problem from anon func