fix output and replace stringBuffer to stringBuilder