Fixed a memory leak in the client