fixes for return codes and ensure parentmessage not set on send

@kentquirk @cheddar if one of you could check this please