relay: check array offset before using it