fix segfault on linux