Fixed potential script errors