add client tests and add error handler