Yes ChatGPT on its own is often wrong. All you need to do it close a feedback loop on it, and together you get to right very quickly. I've pair programmed with it a few times - it writing the code, me providing the feedback via e.g. tests execution. Love it!