Fixes #4289: save directives based on a modified technique on library reload