Factory bugfix

fix for #482