Overhauling of engine would be the best solution provided you get it done by a competent mechanic.
I have not had a very good experience in this regard with the 4m40.
A kabuli 4d46 in my gen1 is running fine for the last 9 yrs and it has been to all parts of the northern areas without any problems. If you can find a low mileage 4d56 or 4m40 in good condition, I would recommend you go for that