Fixing some more issues reported by PVS Studio