improve login check