Several fixes by @tokjun, @lassoan, and myself (crash: https://github.com/openigtlink/OpenIGTLinkIF/pull/23).