                                     if err
                                         cb(err)
                                     else if when_sent >= misc.days_ago(7)   # successfully sent < one week ago -- don't again
-                                        done = true
+                                        locals.done = true
                                         cb()
                                     else
                                         cb()

                            email_address : email_address
                            cb            : (err, _account_id) =>
                                dbg("account_exists: #{err}, #{_account_id}")
                                account_id = _account_id
                                cb(err)
                    (cb) =>
                        if account_id
                            dbg("user #{email_address} already has an account -- add directly")
                            # user has an account already
                            done = true
                            @database.add_user_to_project
                                project_id : mesg.project_id
                                account_id : account_id
                                group      : 'collaborator'
                                cb         : cb
                        else

                                ttl           : 60*60*24*14  # valid for 14 days
                                cb            : cb
                    (cb) =>
                        if locals.done
                            cb()
                        else
                            @database.when_sent_project_invite
