Update to 9588ac - Reset document id after deletion only when there is a document

From: 9588acc0e64bcbe5f90db8d0cf3544772d5b44c7