refactor pred_flag