Fixes 3 warnings reported by gcc 12.1. One is an actual bug but looks like it would not have had any impact.