fix bug with scope