Added JNI code to properly delete string refs