My new Moomba is running like GARBAGE

I had a 04 LSV ran great No problems what so ever. We upgraded to a 07 XLV this year with the 340 with the cat. we've gotten the check engine light on around 15 hours, got it to the dealer for service and it was said to be a bad O2 sensor, Got it back today and its blowing black smoke off take off, running really rich, and missing in low end power... O and the check engine light came right back on.

Any Idea's?