Fix crash based on 1-indexing