fixes var scopes