There's basically three separate changes here, and they could be split up individually. (In general, using "fix X" as a commit subject is not great; here it's a sign that multiple different changes are being grouped together).