fixed hysteresis logic and include file.