another mainloop fix