fix migration bugs