fixed a bug in client code