fixed a threading nullpointer