Fixed regression when using --infill-only-where-needed. Includes regression test. #1721