Merge "Clean up safe_mode_config flag check in the functional code" into main