fix potential overflow in extimatedKeys
merge from 1.2