update sync gateway to check for deleted properly