added tests, fixed login a bit