I've set isSelected=1 on form render but this is not showing on the form [RESOLVED]

I am trying to set the value of a drop-down list when a form is rendered. This is on the first page of the form. I’ve set up tests to be logged and the isSelected value is correctly changed to 1 for the option in question but when I look at the form on screen, the drop-down in question has not updated to show the correct choice. Here’s the code in question:

//$orgCode is determined in by earlier code and should match one of the values in the dropdown list. 

foreach( $form['fields'] as &$field ) {
  if($field->id == 11) {
    $options = $field["choices"];
      foreach ( $options as $fkey => $option ) {
        if($option['value'] == $orgCode){
        GFCommon::log_debug("val1-" . $option['value']); 
          // --> Logged data: "val1-uri" - we have found the correct option
        GFCommon::log_debug("val2-" . $option['isSelected']); 
          //--> Logged data: "val2-" - not selected
        $option['isSelected'] = true;	// --> THE KEY LINE
        GFCommon::log_debug("val3-" . $option['isSelected']); 
          // --> Logged data: "val3-1" - isSelected has apparently been set
      }
    }
  }
}

In case anyone else runs into this problem, the solution I found is to rebuild the options list using the existing list as the source. It does not seem to me like this should be necessary but it seems to be working. Here’s the code that’s working now for me:

foreach( $form['fields'] as &$field ) {
   if($field->id == 11) {
      $options = $field["choices"];
      foreach ( $options as $fkey => $option ) {
         if(	$option['value'] == $orgCode){
           $choices[] = array( 'text' => $option['text'], 'value' => $option['value'], 'isSelected' => true );
         } else {
           $choices[] = array( 'text' => $option['text'], 'value' => $option['value'], 'isSelected' => false );
         }
      }
      $field->choices = $choices;
   }
}