addd test and fixed client bug