added timeout to serial communication.