Fixed issues in class pieces and textWriter