fix checking for scope