Fix bug with duplicate points.
Fix bug with quantization error estimation.