same but with scope checking