migration code fixes