I mistakenly changed the number from 46,000 to 1,000,000 when we reached the max number of farms, forgetting why it was set at that specific number, which led to 1,000,000 * 1,000,000 being computed to a negative number due to overflowing. I changed them to longs now.