Fix length getting out of sync when deleting from an empty heap