Minor fixes

Fixed the write out functions and the read in functions.