Fix for issue : Double counting the key already existed.
Root cause : When updating the order statistics in the tree, did not check if the key already existed.
Solution : Increase key count in the tree only if the key did not exist before.