made the serial comms more robust and failsafe