fixing client instantiation inside method