Solving error associated with object_terrain and looping