Fixes migrating database