More clean up, registry mutex and race conditions