self.agent can and will be a non-object so this needs to be checked