fixed some things with mainloop