Portability fixes for Android 4, release UTF strings properly in JNI