fix many script errors