added proper error handling for Lookup and RemoveRelation