Fix bug and field scope