Fix crash on exception.
Use String.Buffer->sprintf
Minor optimization.