fixed distance for BGP and fixed bug with empty totalTime