Bugfix to gmmsort and check_clusterquality