Fix error sharing instances in factory