Removed a race condition in metadata handling.

Also made the source switch logger work again.