removed set flag function