fixed crashing on refresh