On hysteresis in phase transitions