fixed serial.c as well as added some testing code