Fixed bug in formatResult function

Fixed for #23