Fixed bug regarding 'threshold'