adding check for null cookie array