Fix a function environment missing on loadfile call