make sure factory only get called once