Fix a few bugs in UART test.