Make the conditional correct for print_prefix

Fixes a bug introduced on #1936.
Land #1942