fixed factory to reflect the changes in models of previous commit