fixed visibility issue when restoring state