Wrote fix for random IndexError when calculating stresses.