fixed bug

Fixing bug in sql statement for clustering.