fixing various relay validation issues, and a recursive loop