Fix issue #10032, prioritize exact namespace match in restore
