fixed threads sorting javascript bug