correct_subject_ids function

Correct the wrong subject IDs based on the user-provided values.