Update uart.c

Fix annoying bugs and useless things in the uart code (just so that my bugs wont get passed on to other people). Not compile tested.