OPENUCB-340: Oops! Bug in my last commit - forgot to change all $nid to $result->nid.