fixed the infinite loop of client