I don't actually have a problem right now.
I want to understand how my problem was solved.
I had a custom board based on Atmega 2560.
I was using an Arduino UNO as ISP to program it via the ICSP lines.
Once, after changing some fuse settings it stopped working.
Whenever I tried to program it via arduino IDE or avrdude , it showed the device code as 0x00000 and same for the fuses.
I could not burn any program on it via Arduino as ISP and USBASP.
But when I tried Nick Gammon's Board Programmer code on my Arduino UNO and used it to program the board it detected my controller and also correctly set the fuses.
After that I could use my board normally.
Any idea why such a thing should happen?