Attempted bugfix for when agent is Nil