Convert gather_facts to a boolean value if it is not None

Fixes #5618