fix deprecated (and broken) MainLoop usage