rename __istype to __is metamethod and propagate environments in Function::clone