Fixed error checking. Only errmsg should be checked for error. For example {"ok"=>1.0} is a successful result, but it triggered the error in the previous version.