fix destroying scope