debugging empty from stdlib, swapping to size($pattern) > 0 as an
attempted fix