Fix graph excluding 0 and sorting graphs