fixed a bug with scopes