Fix overflow issue pointed out by @srowen