fixed problem with exit from application