Make migrator more robust, closes item:774