moved checklogin() to init