Fix bug with checking cookie existence