Fixes to maintain login when refreshing the page