Fix bugs with deleted items