fix scope leak