Fix crash.
Add login function.