Added additional check for lambda=0.