fix factory method code samples