Code modifications

small code modifications, sugested by PVS-Studio (static code analyzer).