Fix crash with call java function from main thread