Update migration and fix a bug