I went over vgrid.c very carefully and changed any variable that looked like it could everflow to type size_t.