fixing raster script to avoid premature cessation of activity