     ##
 
     getAffiliation: (node, user, cb) ->
+        unless node
+            return cb(new Error("No node"))
+        unless user
+            return cb(new Error("No user"))
+
         @db.query "SELECT affiliation FROM affiliations WHERE node=$1 AND \"user\"=$2 ORDER BY updated DESC", [ node, user ], cb2
         , (err, res) ->
             cb err, (res?.rows?[0]?.affiliation or "none")
 
     setAffiliation: (node, user, affiliation, cb) ->
+        unless node
+            return cb(new Error("No node"))
+        unless user
+            return cb(new Error("No user"))
+
         db = @db
         async.waterfall [ @validateNode(node)
         , (cb2) ->

        ], cb

    setSubscription: (node, user, listener, subscription, cb) ->
        db = @db
        toDelete = not subscription or subscription == "none"
        async.waterfall [ @validateNode(node)

    ##

    getSubscription: (node, user, cb) ->
        unless node
            return cb(new Error("No node"))
        unless user
            return cb(new Error("No user"))

        db = @db
        async.waterfall [(cb2) ->
            db.query "SELECT subscription FROM subscriptions WHERE node=$1 AND user=$2", [ node, user ], cb2
