mainthread: make it work with kwargs as well