Mac valgrind thread fixes

r? brson