Minor bug fixes after PVS-Studio static testing.