backport of configure_preferences to improve performance of specs (fixes #2484)