Drupal was returning 0 instead of null when there was no match.  Added code to set it to null.