Fix crashes on android.