fix one small bug: when the index is small than 0