Fix bug when App crashes on minimizing and resuming.