add flag to switching directory remove