Here is the patch which calls invalidateTags only after it has been defined.