fix potential overflow in extimatedKeys