Fix crash after exit from activity.