Added handling of invalid cookie settings.