fix file save/load bug, replace endian.h