format output to prevent overflow