bug in threshold proportional, preserving/removing behavior is 1-p from matlab version