Handle number format exceptions more gracefully.