Don't set cookie if we don't need to
Fix JS error