fixed sign error in hysteresis