Fix bug in getGridSize function

Avoid use isl object in Kernel directly. Instead, use their copies.