Fixed freeze when resuming from background