Fix a bug to set userId cookie