Adjust counter variables properly after deleting