small bug fix
fix bug with invalid edges