Fixes #5946 - Only call fact_name_class.maximum if necessary.