Fix a bug that different app will share the same factories