catch_warnings blocks more robust

Explicitely calling clean_warning_registry before with block.