Fix script errors