Fix memory routines (working now).  Data round-trips.  Note that in order to write to memory, the section (or subsection) must have been cleared since the last write.  Also fix atoi.
Typecast to avoid warnings.