src: fixed bugs with threading started twice