other fixes, working on threads race conditions