fix bug in mainloop (this fixes sometimes no more responding e2)