fix bug with app quit