fix hw2: threshold