fixed the bug where r_thresh was set as an integer instead of a real double.