Fixes use of local in script errors