Fixed bugs in rewritten OAuth, still some remain, gonna check them later