Added tests & fixed login problem