Fixes cleanup code with new namespace management.