In write_vmem fix offset and add big endian support