added error checking to zclient