Fix cookie checking