fixed threading (finally)