fixed issue when restoring from background