Fixed some bugs with index's and list length.