Fix exception bug with threshold overlays

See bug #1897.