It was shown time and time again in the first season or two that beneath his trying too hard and lacking common sense in certain social situations, he was a capable professional and often had a better hold on a situation than the people around him. His occasional offensiveness was part of his charm because it was never malicious.
It might not have been malicious but he was racist and sexist. It was part of the character. As the show went on those aspects were toned down and he just got dumber and dumber, with the driving into a lake because his GPS told him to being the tipping point.