It sounds like quite a bit of work is required to fix the epub.
A good start is to upload a copy of the ebook so we can see the coding directly and offer advice how to fix.
You can scramble the ebook first by installing this addon...
https://www.mobileread.com/forums/sh...d.php?t=267998