Fix Bug: IndexError: list index out of range