You automagically swap her body back because the girls want it to happen instead of you escaping with mouse-toph. Looks like it may have been one of those things Marty wanted to do, but ran out of time so it just happens at the end.Man... I spent 30 minutes trying to find some way to return the body to Toph, apparently there isn't one, right? in fact after you escape he talks as if he didn't need it