Fix test segfault on osx