tried to fix app exit bug