fix bug in equivalence class generation