fixed bug in vertex counting