fix bug in modifyIndex