avoid stack overflow