Fixing warnings issued by PVS studio