Optimized serial_write