Fixed a bug where the start index could become a negative value.