Fixed crash when setting threshold.