patch to show function in case curIndex out of range