Revised bug fix for is_valid_in_drupal