When working with ChatGPT to create code allow it to remember the state of the code and any amendments that have been applied. Sometimes it forgets changes it has suggested earlier in a conversation and undoes them.