diff --git a/cel/cel_pgsql.c b/cel/cel_pgsql.c
index 8db85d721448794a3b7c2a30e48d4a8308dd2e33..ceaa34e79c068f7fdf7510a8af37631c2dbb7af2 100644
--- a/cel/cel_pgsql.c
+++ b/cel/cel_pgsql.c
@@ -557,6 +557,10 @@ static int my_load_module(int reload)
 		return AST_MODULE_LOAD_SUCCESS;
 	}
 
+	if (reload) {
+		my_unload_module();
+	}
+
 	process_my_load_module(cfg);
 	ast_config_destroy(cfg);
 
@@ -575,7 +579,6 @@ static int load_module(void)
 
 static int reload(void)
 {
-	my_unload_module();
 	return my_load_module(1);
 }