fix migration code