some startup changes

not sure it's the best solution, but added a main thread