Fixed issue with cookies not setting correctly