fix resetting variables