Refactored the message pipe logic. Added an extra test for this issue. Still need to test this against real hardware.