convert 1-index to 0-index