scope memory management currently broken, pls fix