Fix a potential bug in formatString method.

Signed-off-by: Kristian Duske <kristian.duske@gmail.com>