Fix segfault on large message payloads
Address PR comments