fixed error with defensiveswapcalc