I was trying to use Hansen’s indivible labor model (1985) to build a small open economy model with elastic-debt interest rate approach to induce stationarity. So I first wrote the code for indivisible labor model. The code ran and reported reasonable results. But then when I tried to extend it to small open economy model, however the result become abnormal. Moreover it became very sensitive to the value of parameter that I chose. If by any chances that you figure it out what did I do wrong or you have an idea to change the code please let me know.