Migration bug fixes