make number formatting more robust