Fixed index range errors in lists.