fix factory creation method