In onFirst() function definition, there's a line: for (type in types) `type` is made global since there is no `var`.
In onFirst() function definition, there's a line:
for (type in types)
typeis made global since there is novar.