fix random crashes (linux & maybe windows!)