CGE2: Fix code computing distance