fixed nan bug for empty sets