fixed error in file writing - wrote wrong class