Bugfixes in uart.c and main.c