only cache detections if array is non-zero length