Fixes some NPE exceptions when clearing avatar images in UI.