Fix two bugs leading to crashes when accessing deleted objects.