Fixed variable resetting.