Fix return value of ForEachScript()
Take function objects by value in ForEach* methods