Fix for a subtle race condition in plugin scanning.