fix memory leak on exit
fix pause/quit bug