bugs in new formatter

smarter exception handling

var name corrected