bugfixes in scatter and dist2D plus caching