added a intialization of writingFinished to constructor