Patch from @fyhuang to fix stale login cookies