diff --git a/main/astobj2.c b/main/astobj2.c
index 5e61d5e5f1e260df736b1eeab848d81bff8911e7..5f4cda91ebad83b9d8150419863622ed170be5ea 100644
--- a/main/astobj2.c
+++ b/main/astobj2.c
@@ -734,6 +734,10 @@ static void *internal_ao2_callback(struct ao2_container *c,
 				}
 				ast_free(cur);	/* free the link record */
 			}
+			if ((match) && (!(flags & OBJ_UNLINK))) {
+				AST_LIST_REMOVE_CURRENT(entry);
+				AST_LIST_INSERT_HEAD(&c->buckets[i], cur, entry);
+			}
 
 			if ((match & CMP_STOP) || !(flags & OBJ_MULTIPLE)) {
 				/* We found our only (or last) match, so force an exit from