fixed bugs to calculate stress.