attempt to deal with native library race conditions