fix login and refresh issues