fixed bug in client + added unit tests .