How to control indeterminacy in estimation

I am writing up my own code following ACEL (2005). A common problem for my code is that it is very easy to run into the indeterminant region during the iteration process. Interestingly, my dynare version of code seldomly run into this issue.

I am curious if there is a special way to avoid indeterminacy during estimation.

Thanks for your input.