memory leaks in native code glue fixed