diff --git a/apps/app_dial.c b/apps/app_dial.c
index da8888d5f16f4b00a8b2117b452ab681b4ed2f8f..3920ba4e1d25124ff2e5c572eed2d97aea49d8d1 100755
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -1282,7 +1282,7 @@ out:
 	
 	LOCAL_USER_REMOVE(u);
 	
-	if ((ast_test_flag(peerflags, DIAL_GO_ON)) && (!chan->_softhangup))
+	if ((ast_test_flag(peerflags, DIAL_GO_ON)) && (!chan->_softhangup) && (res != AST_PBX_KEEPALIVE))
 	    res=0;
 	    
 	return res;
diff --git a/pbx.c b/pbx.c
index 77fdfc46143c1ca2b41fe4ad8cd20acce5912ac9..ffc14e5c78739f179d3c4ea04f168d4089dffd3a 100755
--- a/pbx.c
+++ b/pbx.c
@@ -5320,7 +5320,7 @@ int pbx_builtin_setvar(struct ast_channel *chan, void *data)
 	char *name, *value, *mydata, *next, *fstr = NULL;
 	struct ast_flags flags = {0};
 
-	if (data && !ast_strlen_zero(data) && chan->cdr && (mydata = ast_strdupa(data))) {
+	if (data && !ast_strlen_zero(data) && (mydata = ast_strdupa(data))) {
 		next = mydata;
 		while(next) {
 			name = next;