properly use relay values and move relay check