diff --git a/apps/app_queue.c b/apps/app_queue.c
index fa22cbeff95f54c8b33bc68c822fa8c21eef0897..5f7e08ca054ce0716852550dc6596abab93dc181 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -4688,6 +4688,7 @@ static int queue_function_queuewaitingcount(struct ast_channel *chan, const char
 	struct call_queue *q, tmpq = {
 		.name = data,	
 	};
+	struct ast_variable *var = NULL;
 
 	buf[0] = '\0';
 	
@@ -4701,6 +4702,13 @@ static int queue_function_queuewaitingcount(struct ast_channel *chan, const char
 		count = q->count;
 		ao2_unlock(q);
 		queue_unref(q);
+	} else if ((var = ast_load_realtime("queues", "name", data, NULL))) {
+		/* if the queue is realtime but was not found in memory, this
+		 * means that the queue had been deleted from memory since it was 
+		 * "dead." This means it has a 0 waiting count
+		 */
+		count = 0;
+		ast_variables_destroy(var);
 	} else
 		ast_log(LOG_WARNING, "queue %s was not found\n", data);