fix app does not exit on error