Fixing some warnings raised by PVS studio