Fix mem reading bug on linux