trying to fix scope memory