fix the writing of class