correction reading&writting inner classes