Add logic to handle errors. Fix bug in ExtendedStringBuilder.