Fix index bug in migration