relay: fix major crash when sending messages