diff --git a/dnsapi/dns_aws.sh b/dnsapi/dns_aws.sh
index 15bf7b14..2c58754d 100644
--- a/dnsapi/dns_aws.sh
+++ b/dnsapi/dns_aws.sh
@@ -72,7 +72,7 @@ _get_root() {
fi
if _contains "$response" "$h."; then
- hostedzone="$(echo "$response" | _egrep_o ".*$h..*")"
+ hostedzone="$(echo "$response" | sed 's//\n&/g' | _egrep_o ".*$h..*")"
_debug hostedzone "$hostedzone"
if [ -z "$hostedzone" ]; then
_err "Error, can not get hostedzone."
diff --git a/dnsapi/dns_cx.sh b/dnsapi/dns_cx.sh
index 602a5012..86a7b2d0 100755
--- a/dnsapi/dns_cx.sh
+++ b/dnsapi/dns_cx.sh
@@ -58,7 +58,15 @@ dns_cx_add() {
#fulldomain
dns_cx_rm() {
fulldomain=$1
-
+ REST_API="$CX_Api"
+ if _get_root "$fulldomain"; then
+ record_id=""
+ existing_records "$_domain" "$_sub_domain"
+ if ! [ "$record_id" = "" ]; then
+ _rest DELETE "record/$record_id/$_domain_id" "{}"
+ _info "Deleted record ${fulldomain}"
+ fi
+ fi
}
#usage: root sub