Revert "Revert "existLast flag""

This reverts commit 8278ec5412061e0641e149514a7590b4ae2ea78a.