multithread corner case fixes