Try to clean up frontend during refreshing per #808.