fix login redirect from oauth + small refactor