fixed inner context shadowing

closes #8
replace all invocations of Function with safeFunction