weighted median bug