bug with scope