fixed cookie checking