     }
     EAVL_HOSTONLY  void unbind(texture<T> g_textureRef)
     {
-        cudaUnbindTexture(g_textureRef);
-        CUDA_CHECK_ERROR();
+        if(!cpu)
+        {
+            cudaUnbindTexture(g_textureRef);
+            CUDA_CHECK_ERROR();
+        }
+        
     }
 #else
     EAVL_DEVICEONLY const T &getValue(texture<T> g_textureRef, int index) const

template<class T>
class eavlConstArrayV2
{
  public:
    T *host;
    T *device;
  public:
    eavlConstArrayV2(T *from, int N, texture<T> &g_textureRef)
    {
        host = from;

#ifdef HAVE_CUDA
        int nbytes = N * sizeof(T);
        cudaMalloc((void**)&device, nbytes);
        CUDA_CHECK_ERROR();
        cudaMemcpy(device, &(host[0]),
                   nbytes, cudaMemcpyHostToDevice);
        CUDA_CHECK_ERROR();
#ifdef USE_TEXTURE_MEM
        cudaBindTexture(0, g_textureRef,device,nbytes);
        CUDA_CHECK_ERROR();
#endif

#endif
    }
    ~eavlConstArrayV2()
    {

    indexScan = NULL;
    setDefaultColorMap();
    cout<<"Construtor Done. Dirty"<<endl;


    if(eavlExecutor::GetExecutionMode() == eavlExecutor::ForceCPU ) cpu = true;
    else cpu = false;
}

void eavlRayTracerMutator::setColorMap3f(float* cmap,int size)
