add XInitThreads() call to main function