[IMP]imporved migration code