add exitflag when recursive methods called