Increased MAX_TEXTURES to 32 and added workaround for weird CUDA bug.