add better error message when application stopped