Fix bug: virtual root off-by-one error