Fixed freezing issue and close panel after replacing.