Fixed a small bug in chunk indexing