fixed numerous migration bugs