Fixed an issue in the iteration through the spatial values.