synchronization with C++ version
Merge branch 'master' into android-1.5