Fix stack overlow