--- flickrsync.module~  2012-01-09 18:12:35.353923853 +0100
+++ flickrsync.module   2012-01-09 19:05:55.100084419 +0100
@@ -309,12 +309,12 @@
 /**
  * Helper function, to get drupal user details for a flickr user
  */
-function flickrsync_get_user_by_flickruser($fuser) {
+function flickrsync_get_user_by_flickruser($fuser, $fnsid) {
   if (!$fuser) {
     drupal_set_message(t("Cannot search for blank username"));
     return;
   }
-  $result = db_query("SELECT * FROM {flickrsync_users} WHERE nsid = :nsid OR identifier = :identifier", array(':nsid' => $fuser, ':identifier' => $fuser));
+  $result = db_query("SELECT * FROM {flickrsync_users} WHERE nsid = :nsid OR identifier = :identifier", array(':nsid' => $fnsid, ':identifier' => $fuser));
   foreach ($result as $record) {
     $user = user_load($record->uid);
     return $user;
@@ -398,9 +398,10 @@
   // TODO: This is problematic because yahoo users can potentially user username@yahoo.com but the photoinfo will only have username sans @yahoo.com
   // flickr username
   $flickrusername = $flickr_photo['owner']['username'];
+  $flickrnsid = $flickr_photo['owner']['nsid'];
 
   // get user details
-  $user = flickrsync_get_user_by_flickruser($flickrusername);
+  $user = flickrsync_get_user_by_flickruser($flickrusername, $flickrnsid);
   if (empty($user)) {
     drupal_set_message(t("User doesn't exist, unable to save image %photo_id", array('%photo_id' => $photo_id)));
     return FALSE;
@@ -746,4 +747,4 @@
     $photo_id = flickrsync_get_photo_id($nid);
     flickrsync_update_node($photo_id, TRUE);
   }
-}
\ No newline at end of file
+}
