pausing and restore from the background