Several protections for nprim = 0 added. In this case Edep() should return