some fixes before I modify do_fit to include different meshes as an input