math errors when calculating gridview