guarding more cases of handle scope

part of #2489