Fix NumberFormatException caused by integer overflow
Fix several crashes