fixed bug with end-vertex