Fix possible crash when having identical subspaces in multiple root spaces