update entry if key exists; minor refactoring for indexOfInBucket