TorusDistance fix