Fix overflow bug in mathy.