Fixing the bug of cookie creation on first arrival