Fixes and improvements to FormatUtils