Fix errors in factories