added logout and fixed login error