Thread starts before important variables init bug fixed