simplify StringBuffer implementation