added optimize-tree hook, reset module on build