In b4 Ghost Nia's bad end rant. The whole thing about tuning the world that had been mentioned several times came into play. Hayato basically had the power of a god, and could remake the world as he saw fit.
So he gave everybody good ends. Even the Mu or whatever they were called.