fix scope leakage