fixed weird segfault in native library