changes in read_serial to make os independent