modified C & added JNI_OnLoad