added relogin logic