Fix migration code