Fix several newly introduced bugs in the migration to mutable strings