Fix overflow caused by signed long division by unsigned long.