fix bug in threshold extractation and storing