Fixed index out of bounds in script.py