Fix OSX compile
fix valgrind