Fix clustering bugs
Merge branch 'master' into gh-pages