Fix null pointer exception for deleted contacts