fix segfault issue #12