Added a check to see if relay is set.