Fixed edge calculation issue