fix scope bug