Fix various unit-test related problems. Compiled with clang on OS X