add vertex count check