Better active assembly handling to prevent crashes due to dangling pointers