scope ordering fixes