modded readSerialId for Unix and Windows