fix scopes properly