Improved the code that supports --inherit.