Fixed the AhbSeri and the leonSer functions to work automatically detect OS and to correctly read and write data.