Fix number format exception handling