diff --git a/main/app.c b/main/app.c
index 2bcf5f38f8f6b1fc609e94e9cf225894296c0c1c..c37279658c6c3e7f8e7c7459c4b0459417090bf6 100644
--- a/main/app.c
+++ b/main/app.c
@@ -492,7 +492,7 @@ int ast_app_inboxcount2(const char *mailbox, int *urgentmsgs, int *newmsgs, int
 	if (urgentmsgs) {
 		*urgentmsgs = 0;
 	}
-	if (ast_inboxcount_func) {
+	if (ast_inboxcount2_func) {
 		return ast_inboxcount2_func(mailbox, urgentmsgs, newmsgs, oldmsgs);
 	}