fix segfault in perft()