bugfix: when there were more indices than vertices the indices were incorrect.

use the vertex count to calculate the global indices.