threads and random fixes