cookie index exception fix