Fix issue: 'factories' keeps danlging objects after extend