Fix bug with reset scope