LXD VMs not getting IPv4 attached properly

Sometime while trying to attach IP v4 to a LXD VMs either it attaches a different value or no value at all. I used command say lxc config device set VMNAME eth0 ipv4.address 127.0.0.22 but assigned IP was something else like 129.0.0.39 or blank at all.
Before setting this IP I stop the VM, attach network with command lxc network attach lxdbr0 VMNAME eth0 eth0 and then finally after attaching IP re-started the VM.
But somehow if I try lxc config device get VMNAME eth0 ipv4.address it shows correct value 127.0.0.22.
whereas lxc list shows the wrong value.