previous fix was wrong, bug in threshold_proportional now fixed and same as matlab behavior