fixed some issue related to app recovery from background