relay: fix some corner cases when parsing messages for spans