added cookie validation conditional