Prevented double initialization of server
Fixed thread memory leak.