fix bug in adding threshold checks