fixed a data race
reorganizing a little
stupid races
something is wrong, but i don't know what.