tweaks to improve reliability in edge cases

Fix for wrong TSV numbers when number of layers = 1
Fix for N_power_pads not increasing properly