As you have already done all the required "setenv" steps once, no need to do it again.
Just boot the inintamfs-Image and write the "factory image" via ubiformat to the correct mtd-patitions.
ubiformat /dev/mtd18 -y -f /path_to/factory_image
ubiformat /dev/mtd20 -y -f /path_to/factory_image
After a reboot openwrt should come up again.