fix $scopes does not defined