Is all of the gateway in the /pi/home/gateway folder?
I don't remember, if you want to delete whole gateway app, you delete that folder or something else has to be done, before upgrade?
Let's say you can't delete the image because of many changes to it