Fixed a tuple index out of range