Added real tests for client module and fixed a couple of issues