fix bug in specifying threshold.
remove debug messages.