in case of recursion, terminate adding flags