Native code fixes