index must start from 0