try to fix race condition in Sort.equals

@yilongli please review