Updated login

Updated and stablisized login controll in demo app. It also fixes
chatlog not loading correctly.