add return to base with flag logic