logout implemented. and a few issue fixed.