Okay, so a little background first- I accidentally format the /factory folder due to which my phone lost the IMEI number and couldn't register itself on the network. I have got that problem fixed from a local shopkeeper, though not sure what he did. Now I have a working phone with stock jelly bean ROM but whenever I switch the ROM, the phone loses the IMEI again and I have to restore the backup which I took after getting the phone fixed. I am able to flash new kernels but not the ROM. Is there a particular folder/file which I should restore from the backup after flashing the new ROM which would keep the IMEI intact?